---
title: "OpenAPI & Other Languages"
sidebar_label: "OpenAPI"
sidebar_position: 325
---

import Load from "!!raw-loader!@site/../private-demos/snippets/convex/goClientExample.ts";
import Go from "!!raw-loader!@site/../private-demos/snippets/goExample.txt";

Convex doesn’t have explicit support for many languages including Go, Java, and
C++. However, you can generate [OpenAPI](https://swagger.io/specification/)
specifications from your Convex deployment to create type-safe clients for
languages that aren't currently supported. Under the hood, this uses our
[HTTP API](/http-api). This means that your queries will not be
reactive/real-time.

<BetaAdmonition feature="OAS generation" verb="is" />

## Setup

<StepByStep>
  <Step title="Install the Convex Helpers npm package">
    Install the `convex-helpers` package, which contains a CLI command to generate an Open API specification.

    ```sh
    npm install convex-helpers
    ```

  </Step>
  <Step title="Run a command to generate an OpenAPI specification">
    Running this command will call into your configured Convex deployment and generate an `convex-spec.yaml` file based
    on it. You can see additional flags by passing `--help` to the command.

    ```sh
    npx convex-helpers open-api-spec
    ```

  </Step>
  <Step title="Generate a type-safe client">
    You can use a separate tools to generate a client from the `convex-spec.yaml` file. Some popular options are [OpenAPI Tools](https://github.com/OpenAPITools/openapi-generator) and [Swagger](https://swagger.io/tools/swagger-codegen/).
    ```yaml
    # convex-spec.yaml
    openapi: 3.0.3
    info:
      title: Convex App - OpenAPI 3.0
      version: 0.0.0
      servers:
        - url: "{hostUrl}"
      description: Convex App API
      ...
    ```
  </Step>
</StepByStep>

## Example

Below are code snippets of what this workflow looks like in action. These
snippets include two different files:

- `convex/load.ts` - contains Convex function definitions
- `convex.go` - contains `Go` code that uses a generated, type-safe `HTTP`
  client. This client was generated by installing the
  [OpenAPI Tools](https://github.com/OpenAPITools/openapi-generator) package and
  running the command
  `npx openapi-generator-cli generate -i convex-spec.yaml -g go -o convex_client`

<TSAndJSSnippet title="convex/load.ts" sourceTS={Load} sourceJS={Load} />

<Snippet source={Go} title="convex.go" />

## Limits

- Argument and return value validators are not required, but they will enrich
  the types of your OpenAPI spec. Where validators aren't defined, we default to
  `v.any()` as the validator.
- You cannot call internal functions from outside of your Convex deployment.
- We currently do not support `bigints` or `bytes`.
